package com.example.yiwei.crm.view.Class.gridViewClass;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.example.yiwei.crm.R;

/**
 * Created by Administrator on 2017/6/26.
 */

public class QuertGridAdapter extends BaseAdapter {
    private Context mContext;
    public String[] img_text = { "合作客户", "拜访", "交流", "患者", "预约", "接待","用车"};
    public int[] imgs ={R.drawable.hezuo, R.drawable.baifang3, R.drawable.jiaoliu, R.drawable.u84, R.drawable.
            yy3, R.drawable.jiedai1,R.drawable.car};
    public QuertGridAdapter(Context mContext) {
        super();
        this.mContext = mContext;
    }
    @Override
    public int getCount() {
        return img_text.length;
    }

    @Override
    public Object getItem(int position) {
        return position;
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent)
    {
        if (convertView == null) {
            convertView = LayoutInflater.from(mContext).inflate(
                    R.layout.grid_item, parent, false);
        }
        TextView tv = BaseViewHolder.get(convertView, R.id.tv_item);
        ImageView iv = BaseViewHolder.get(convertView, R.id.iv_item);
        iv.setBackgroundResource(imgs[position]);

        tv.setText(img_text[position]);
        return convertView;
    }

}
